package service.truth;

import vo.MemberVO;
import vo.ReviewVO;
import vo.TruthVO;
import dao.truth.TruthDAO;

public class TruthServiceImpl implements TruthService{

	private TruthDAO truthDAO;

	public void setTruthDAO(TruthDAO truthDAO) {
		this.truthDAO = truthDAO;
	}

	@Override
	public int voteTruth(int review_no, int member_no, int truth_vote) throws Exception {
		//이미 투표:0 / 진실:1 / 거짓:-1
		int message=0;
		TruthVO tvo=new TruthVO(new ReviewVO(review_no), new MemberVO(member_no), truth_vote);
		if(truthDAO.didVoteTruth(tvo)==0){
			truthDAO.voteTruth(tvo);
			message=truth_vote;
		}
		return message;
	}
}
